home *** CD-ROM | disk | FTP | other *** search
- ;FILE :SCRREST (Restores screen from an integer array)
- ;USEAGE :SCRREST (ARRAY%(),AREA%) Restore screen to arrary%(0)+2000*AREA%
- scrrest segment
- assume cs:scrrest
- push bp ;save bp
- mov bp,sp
- push ds ;save this too!
-
- les di,[bp+6] ;Calculate offset into array.
- mov ax,es:[di] ;Let's see where to go in array.
- mov bx,4000
- mul bx ;4000 bytes per page.
- mov si,ax ;This is offset into array. (Source)
- mov di,0 ;Start at begining of screen area. (Destination)
- ;Let's figure out display address/color or monochrome?
- mov bx,0040h ;seg that has vid info.
- mov es,bx
- mov dx,es:[063h] ;base address of video port
- add dx,6 ;we want base+6
- mov ax,0b000h ;monochrome address
- mov bx,es:[010h] ;display mode set
- and bx,110000b ;mask off what we want
- cmp bx,110000b ;are we color?
- jz mono ;jump if monochrome is set.
- mov ah,0b8h ;base address of color
- mono: mov es,ax ;No let's set source segment.
- mov ax,[bp+10] ;Set DS to start of array. (Source)
- push ax
- pop ds
- mov cx,2000 ;Move 2000 words.
- cld ;Clear direction flag for string move.
- loopm: cli ;NO IRQS while I'm working!
- notyet: in al,dx ;read video board
- shr al,1 ;bit we want is 0
- jb notyet
- sti ;Let'm get outa the car and go potty
- nop ;pass some time folks
- cli
- notyet2:in al,dx
- shr al,1
- jnb notyet2
- movsw
- sti ;OK IRQS again
- loop loopm
-
- pop ds
- pop bp
-
-
- scrrest ends
- end